﻿using System.Data.Entity.ModelConfiguration;

namespace CS795.TravelAgency.Domain.Entities.Configurations
{
    public class RoleConfiguration : EntityTypeConfiguration<Role>
    {
        public RoleConfiguration()
        {
            HasKey(p => p.Id);
            Property(p => p.Name).HasMaxLength(100).IsRequired();
            HasMany(p => p.Users).WithMany(r => r.Roles).Map(m => m.MapLeftKey("RoleId").MapRightKey("UserId").ToTable("UserRoles"));
        }
    }
}
